#ifndef __twap
#define __twap

#include "bot.h"
#include "basic_viewer.h"

struct twap : bot { // time weighted average price bot

  int total_trades; // number of trades bot can do to achieve objective 
  double trade_interval; // time between two successive trades
  
  int trade_size; // number of shares per trade
  double size_error; // due to truncating calculation of trade_size; if >= 1, +1 trade_size 
  double cur_size_error;  

  double TWAP; // the TWAP
  
  int run (double secs); // runs the bot
  
  double get_trade_interval ();
  int get_trade_size (double t);
  
  basic_viewer viewer; // for viewing progress
    
  twap (const std::string& _name, const std::string& _symbol, int hs, int ms, int ss, int he, int me, int se, int _exec, int _num_shares, int _total_trades, double _finish_price, double _stop_price);
  ~twap ();
};

#endif
